﻿<SettingsFlyout x:Class="AdventureWorks.Shopper.Views.ChangeDefaultsFlyout"
                           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                           xmlns:designViewModels="using:AdventureWorks.Shopper.DesignViewModels"
                           xmlns:Infrastructure="using:Microsoft.Practices.Prism.StoreApps"
                           mc:Ignorable="d"
                           Title="Change Defaults"
                           Background="White"
                           x:Uid="Page"
                           Infrastructure:ViewModelLocator.AutoWireViewModel="true"
                           d:DataContext="{d:DesignInstance designViewModels:ChangeDefaultsDesignViewModel, IsDesignTimeCreatable=True}">

    <!-- Settings Panel Content -->
    <Grid>
    <ScrollViewer VerticalScrollBarVisibility="Auto"
                          Grid.Row="1">
        <StackPanel VerticalAlignment="top">

            <!-- Shipping Address -->
            <Button x:Name="ExpandShippingAddressButton"
                            x:Uid="ExpandShippingAddressButton"
                            AutomationProperties.AutomationId="ExpandShippingAddressButton">
                    <Button.Flyout>
                        <Flyout>
                            <ScrollViewer
                                  MaxHeight="270"
                                  MaxWidth="285">
                                <ListView x:Name="ShippingAddressList"
                                  AutomationProperties.AutomationId="ShippingAddressList"
                                  SelectionMode="Single"
                                  ItemTemplate="{StaticResource CheckoutDataFlyoutTemplate}"
                                  ItemsSource="{Binding ShippingAddresses}"
                                  SelectedItem="{Binding SelectedShippingAddress, Mode=TwoWay}"
                                  HorizontalAlignment="Stretch" />
                            </ScrollViewer>
                        </Flyout>
                    </Button.Flyout>
                <Button.Content>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock x:Uid="ShippingAddressLabel"
                                           Text="Shipping Address"
                                           TextTrimming="WordEllipsis"
                                           Style="{StaticResource GroupHeaderTextStyle}" />
                        <TextBlock x:Name="ShippingAddressChevronGlyph"
                                           Text="{StaticResource OpenedChevronGlyph}"
                                           FontFamily="{StaticResource SymbolThemeFontFamily}"
                                           Margin="10,0"
                                           Style="{StaticResource GroupHeaderTextStyle}" />
                    </StackPanel>
                </Button.Content>
            </Button>
            <StackPanel Height="60"
                                Margin="0,10,20,20">
                <TextBlock Text="No default Shipping Address is selected."
                                   x:Uid="NoDefaultShippingAddressLabel"
                                   Style="{StaticResource BodyTextBlockStyle}"
                                   Visibility="{Binding SelectedShippingAddress, Converter={StaticResource NullToVisibleConverter}}" />
                <ContentControl DataContext="{Binding SelectedShippingAddress}" IsTabStop="False">
                    <ContentControl.Content>
                        <StackPanel Visibility="{Binding SelectedShippingAddress, Converter={StaticResource NotNullToVisibleConverter}}">
                            <TextBlock Text="{Binding FirstLine}"
                                               Style="{StaticResource BodyTextBlockStyle}" />
                            <TextBlock Text="{Binding SecondLine}"
                                               Style="{StaticResource BodyTextBlockStyle}" />
                            <TextBlock Text="{Binding BottomLine}"
                                               Style="{StaticResource BodyTextBlockStyle}" />
                        </StackPanel>
                    </ContentControl.Content>
                </ContentControl>
            </StackPanel>

            <!-- Billing Address -->
            <Button x:Name="ExpandBillingAddressButton"
                            x:Uid="ExpandBillingAddressButton"
                            AutomationProperties.AutomationId="ExpandBillingAddressButton">
                    <Button.Flyout>
                        <Flyout Placement="Bottom">
                            <ScrollViewer
                                  MaxHeight="270"
                                  MaxWidth="285">
                                <ListView x:Name="BillingAddressList"
                                  AutomationProperties.AutomationId="BillingAddressList"
                                  SelectionMode="Single"
                                  ItemTemplate="{StaticResource CheckoutDataFlyoutTemplate}"
                                  ItemsSource="{Binding BillingAddresses}"
                                  SelectedItem="{Binding SelectedBillingAddress, Mode=TwoWay}"
                                  HorizontalAlignment="Stretch" />
                            </ScrollViewer>
                        </Flyout>
                    </Button.Flyout>
                <Button.Content>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock x:Uid="BillingAddressLabel"
                                           Text="Billing Address"
                                           TextTrimming="WordEllipsis"
                                           Style="{StaticResource GroupHeaderTextStyle}" />
                        <TextBlock x:Name="BillingAddressChevronGlyph"
                                           Text="{StaticResource OpenedChevronGlyph}"
                                           FontFamily="{StaticResource SymbolThemeFontFamily}"
                                           Margin="10,0"
                                           Style="{StaticResource GroupHeaderTextStyle}" />
                    </StackPanel>
                </Button.Content>
            </Button>
            <StackPanel Height="60"
                                Margin="0,10,20,20">
                <TextBlock Text="No default Billing Address is selected."
                                   x:Uid="NoDefaultBillingAddressLabel"
                                   Style="{StaticResource BodyTextBlockStyle}"
                                   Visibility="{Binding SelectedBillingAddress, Converter={StaticResource NullToVisibleConverter}}" />
                <ContentControl DataContext="{Binding SelectedBillingAddress}" IsTabStop="False">
                    <ContentControl.Content>
                        <StackPanel Visibility="{Binding SelectedBillingAddress, Converter={StaticResource NotNullToVisibleConverter}}">
                            <TextBlock Text="{Binding FirstLine}"
                                               Style="{StaticResource BodyTextBlockStyle}" />
                            <TextBlock Text="{Binding SecondLine}"
                                               Style="{StaticResource BodyTextBlockStyle}" />
                            <TextBlock Text="{Binding BottomLine}"
                                               Style="{StaticResource BodyTextBlockStyle}" />
                        </StackPanel>
                    </ContentControl.Content>
                </ContentControl>
            </StackPanel>

            <!-- Payment Method -->
            <Button x:Name="ExpandPaymentMethodButton"
                            x:Uid="ExpandPaymentMethodButton"
                            AutomationProperties.AutomationId="ExpandPaymentMethodButton">
                    <Button.Flyout>
                        <Flyout Placement="Bottom">
                            <ScrollViewer
                                  MaxHeight="270"
                                  MaxWidth="285">
                                <ListView x:Name="PaymentMethodList"
                                  AutomationProperties.AutomationId="PaymentMethodList"
                                  SelectionMode="Single"
                                  ItemTemplate="{StaticResource CheckoutDataFlyoutTemplate}"
                                  ItemsSource="{Binding PaymentMethods}"
                                  SelectedItem="{Binding SelectedPaymentMethod, Mode=TwoWay}"
                                  HorizontalAlignment="Stretch" />
                            </ScrollViewer>
                        </Flyout>
                    </Button.Flyout>
                <Button.Content>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock x:Uid="PaymentMethodLabel"
                                           Text="Payment Method"
                                           TextTrimming="WordEllipsis"
                                           Style="{StaticResource GroupHeaderTextStyle}" />
                        <TextBlock x:Name="PaymentMethodChevronGlyph"
                                           Text="{StaticResource OpenedChevronGlyph}"
                                           FontFamily="{StaticResource SymbolThemeFontFamily}"
                                           Margin="10,0"
                                           Style="{StaticResource GroupHeaderTextStyle}" />
                    </StackPanel>
                </Button.Content>
            </Button>
            <StackPanel Height="60"
                                Margin="0,10,20,20">
                <TextBlock Text="No default Payment Method is selected."
                                   x:Uid="NoDefaultPaymentMethodLabel"
                                   Style="{StaticResource BodyTextBlockStyle}"
                                   Visibility="{Binding SelectedPaymentMethod, Converter={StaticResource NullToVisibleConverter}}" />
                <ContentControl DataContext="{Binding SelectedPaymentMethod}" IsTabStop="False">
                    <ContentControl.Content>
                        <StackPanel Visibility="{Binding SelectedPaymentMethod, Converter={StaticResource NotNullToVisibleConverter}}">
                            <TextBlock Text="{Binding FirstLine}"
                                               Style="{StaticResource BodyTextBlockStyle}" />
                            <TextBlock Text="{Binding SecondLine}"
                                               Style="{StaticResource BodyTextBlockStyle}" />
                            <TextBlock Text="{Binding BottomLine}"
                                               Style="{StaticResource BodyTextBlockStyle}" />
                        </StackPanel>
                    </ContentControl.Content>
                </ContentControl>
            </StackPanel>

            <Button x:Uid="SaveButton"
                            AutomationProperties.AutomationId="SaveButton"
                            Background="{StaticResource AWShopperAccentBrush}"
                            Content="Save"
                            HorizontalAlignment="Stretch"
                            Margin="0,20,20,0"
                            Foreground="{StaticResource AWShopperButtonForegroundBrush}"
                            Command="{Binding SaveCommand}" />
        </StackPanel>
    </ScrollViewer>
    </Grid>
</SettingsFlyout>